﻿@using System.Data
@using ZoomLa.BLL
@using ZoomLa.BLL.Helper
@using ZoomLa.BLL.Shop
@using ZoomLa.Model
@using ZoomLa.Model.Shop
@using ZoomLa.Common
@model ZoomLaCMS.Areas.User.Models.VM_OrderPro
@{

    B_Order_Exp expBll = new B_Order_Exp();
    B_OrderList orderBll = new B_OrderList();
    B_Order_Invoice invBll = new B_Order_Invoice();
    M_Order_Exp expMod = expBll.SelReturnModel(DataConverter.CLng(Model.orderMod.ExpressNum));
    M_Order_Invoice invMod = invBll.SelModelByOid(Model.orderMod.id);
    if (invMod == null) { invMod = new M_Order_Invoice(); }
    string compname = "";
    string expcode = "";
    if (expMod != null)
    {
        compname = expMod.ExpComp;
        expcode = expMod.ExpNo;
    }
    M_Payment payMod = OrderHelper.GetPaymentByOrderNo(Model.orderMod.PaymentNo, Model.orderMod.OrderNo, Model.orderMod.Ordersamount);
}
@functions{
    OrderCommon orderCom = new OrderCommon();
    public string GetMyPrice(DataRow dr)
    {
        return DataConverter.CDouble(dr["AllMoney"]).ToString("F2");
    }
    public string GetShopUrl(DataRow dr)
    {
        return OrderHelper.GetShopUrl(DataConverter.CLng(dr["StoreID"]), DataConverter.CLng(dr["ProID"]));
    }
    public MvcHtmlString GetTotal(M_Payment payMod)
    {
        string html = "<span>总计：</span>" + Model.orderMod.Ordersamount.ToString("F2") + "元";
        html += " - <span>优惠：</span>" + payMod.ArriveMoney.ToString("F2") + "元";
        html += " - <span>积分：</span>" + payMod.UsePoint + "个";
        html += " = <span>需付：</span>" + payMod.MoneyReal + "元";
        return MvcHtmlString.Create(html);
    }
    //除酒店,虚拟,旅游等外,显示快递信息
    public bool ShowExp()
    {
        return (Model.orderMod.Ordertype != 7 && Model.orderMod.Ordertype != 9);
    }
}
@section head{
<title>订单商品列表</title>
<style>.SumDiv li{list-style:none;display:inline-table;margin-right:50px;line-height:10px}
.panel-footer div{margin:5px 0}
.panel-footer div b{margin:3px 0 8px 0}
.panel-footer div .item{margin-left:2em}
.itemWrap{margin-top:5px;border-bottom:1px dashed #ddd;}
</style>
}
@section content{
<div class="container margin_t5">
    <ol class="breadcrumb">
        <li><a title="会员中心" href="@Url.Action("Default","")">会员中心</a></li>
        <li><a href="OrderList">我的订单</a></li>
        <li class="active">商品列表</li>
        <div class="clearfix"></div>
    </ol>
    <div class="panel panel-default">
        <div class="panel-body">
            <table class="table table-bordered table-striped">
                <tr><td>ID</td><td>商品名</td><td>商品数</td><td>金额</td><td>日期</td></tr>
                @foreach (DataRow dr in Model.proDT.Rows)
                {
                    <tr>
                        <td class="td_s">@dr["ID"]</td>
                        <td><a href="@GetShopUrl(dr)" target="_blank" title="浏览商品">@dr["ProName"]</a>@OrderHelper.GetSnapUrl(Model.mu.UserID, Model.orderMod.OrderNo, dr["ProID"])</td>
                        <td>@dr["Pronum"]</td>
                        <td>@GetMyPrice(dr)</td>
                        <td>@DateHelper.ToDate(dr["AddTime"])</td>
                    </tr>
                }
            </table>
            <div class="itemWrap">
                <b>付款信息</b>
                <span class="item"><span class="title">订单金额：</span>@GetTotal(payMod)</span>
                <span class="item"><span class="title">已付款：</span>@Model.orderMod.Receivablesamount.ToString("f2")元</span>
            </div>
            @if (ShowExp())
            {
                <div id="exp_div" class="itemWrap">
                    <b>物流信息</b>
                    <span class="item"><span class="title">快递公司：</span>@compname</span>
                    <span class="item"><span class="title">物流单号：</span>@expcode</span>
                    @if (!string.IsNullOrEmpty(compname) && !string.IsNullOrEmpty(expcode))
                    {
                        <a href="http://m.kuaidi100.com/index_all.html?type=@compname&postid=@expcode&callbackurl=@Request.Url.AbsoluteUri" target="_blank">查看物流信息</a>
                    }
                </div>
            }
            <div class="itemWrap">
                <b>收货信息</b>
                <span class="title">收 货 人 ：</span>
                <span>@orderBll.ShowReceAddress(Model.orderMod)</span>
                <span class="title">手机：</span><span>@Model.orderMod.MobileNum</span>
            </div>
            <div class="itemWrap">
                <b>发票信息</b>
                <span class="title">抬头：</span><span>@invMod.InvHead</span>
                <span class="title">识别号：</span><span>@invMod.UserCode</span>
                <span class="title">明细：</span><span>@invMod.InvContent</span>
            </div>
            <div class="itemWrap">
                <b>备注信息</b>
                <span class="item"><label>@Model.orderMod.Ordermessage</label></span>
            </div>
        </div>
        <div class="panel-footer">
            <div class="text-center">
                @if (Model.orderMod.Paymentstatus != (int)M_OrderList.PayEnum.HasPayed)
                {
                    <a href="/PayOnline/OrderPay.aspx?PayNo=@payMod.PayNo" id="PayUrl_A" target="_blank" class="btn btn-primary">前往付款</a>
                }
                
                <a href="javascript:history.back();" class="btn btn-default margin_l5">返回</a>
            </div>
        </div>
    </div>
@if(Model.clientList!=null)
{
    <div class="panel panel-primary" id="User_Div">
        <div class="panel-heading"><span class="fa fa-user"></span><span class="margin_l5">客户详情</span></div>
        <div class="panel-body">
            <table class="table table-bordered">
                <tr><td class="td_m">姓名</td><td>证件号</td><td>手机</td><td>备注</td></tr>
                @foreach (var client in Model.clientList)
                {
                    <tr>
                        <td>@client.Name</td>
                        <td>@client.CertCode</td>
                        <td>@client.Mobile</td>
                    </tr>
                }
            </table>
        </div>
    </div>
}
    
</div>
}
@section script{}